package com.cq.ssm.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.cq.ssm.mapper.PoliticalMapper;
import com.cq.ssm.po.Political;
import com.cq.ssm.service.PoliticalService;

@Component("politicalService")
public class PoliticalServiceImpl implements PoliticalService {

	@Autowired
	private PoliticalMapper pm;
	// 插入一条记录
	public boolean insertPolitical(Political political) throws Exception {
		int i = pm.insertSelective(political);
		return i==1?true:false;
	}

	// 根据id删除一条记录
	public boolean deleteById(Integer id) throws Exception {
		int i = pm.deleteByPrimaryKey(id);
		return i==1?true:false;
	}

	// 查询所有记录
	public List<Political> findAll() throws Exception {
		return pm.selectAllPolitical();
	}
}
